//轮播图
$(function(){
    $.ajax({
        url:"../data/index.php",
        type:'get',
        dataType:'json',
        data:{
            flag:"wap"
        },
        success:function(data){
            var html = template('index-temp',data);//模板渲染
            $('.test').html(html);  
            
            event();
        }
    });

    function event(){
        //轮播
        var mySwiper = new Swiper ('.swiper-container', {
        // direction: 'vertical',
        autoplay:3000,
        loop: true,
        
        // 如果需要分页器
        pagination: '.swiper-pagination',
      });
    };
	

  //顶部导航
    var objTop = $('.index-search').offset().top;
    $(window).scroll(function(){
    	var scrollTop = document.body.scrollTop || document.documentElement.scrollTop;

    	if (objTop <= scrollTop) {
    		$('.index-search').css("position","fixed");
    	}else{
    		$('.index-search').css("position","static");
    	}
    }); 

});
